Optimal. Leaf size=170 \[ \frac {\left (-2 a^2 B+8 a A b+9 b^2 B\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac {1}{8} x \left (4 a^2 B+8 a A b+3 b^2 B\right )+\frac {\left (a^3 (-B)+4 a^2 A b+8 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 b d}+\frac {(4 A b-a B) \sin (c+d x) (a+b \cos (c+d x))^2}{12 b d}+\frac {B \sin (c+d x) (a+b \cos (c+d x))^3}{4 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.23, antiderivative size = 170, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {2968, 3023, 2753, 2734} \[ \frac {\left (4 a^2 A b+a^3 (-B)+8 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 b d}+\frac {\left (-2 a^2 B+8 a A b+9 b^2 B\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac {1}{8} x \left (4 a^2 B+8 a A b+3 b^2 B\right )+\frac {(4 A b-a B) \sin (c+d x) (a+b \cos (c+d x))^2}{12 b d}+\frac {B \sin (c+d x) (a+b \cos (c+d x))^3}{4 b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2734
Rule 2753
Rule 2968
Rule 3023
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx &=\int (a+b \cos (c+d x))^2 \left (A \cos (c+d x)+B \cos ^2(c+d x)\right ) \, dx\\ &=\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}+\frac {\int (a+b \cos (c+d x))^2 (3 b B+(4 A b-a B) \cos (c+d x)) \, dx}{4 b}\\ &=\frac {(4 A b-a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 b d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}+\frac {\int (a+b \cos (c+d x)) \left (b (8 A b+7 a B)+\left (8 a A b-2 a^2 B+9 b^2 B\right ) \cos (c+d x)\right ) \, dx}{12 b}\\ &=\frac {1}{8} \left (8 a A b+4 a^2 B+3 b^2 B\right ) x+\frac {\left (4 a^2 A b+4 A b^3-a^3 B+8 a b^2 B\right ) \sin (c+d x)}{6 b d}+\frac {\left (8 a A b-2 a^2 B+9 b^2 B\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {(4 A b-a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 b d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.46, size = 118, normalized size = 0.69 \[ \frac {12 (c+d x) \left (4 a^2 B+8 a A b+3 b^2 B\right )+24 \left (4 a^2 A+6 a b B+3 A b^2\right ) \sin (c+d x)+24 \left (a^2 B+2 a A b+b^2 B\right ) \sin (2 (c+d x))+8 b (2 a B+A b) \sin (3 (c+d x))+3 b^2 B \sin (4 (c+d x))}{96 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.75, size = 114, normalized size = 0.67 \[ \frac {3 \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} d x + {\left (6 \, B b^{2} \cos \left (d x + c\right )^{3} + 24 \, A a^{2} + 32 \, B a b + 16 \, A b^{2} + 8 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.38, size = 124, normalized size = 0.73 \[ \frac {B b^{2} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {1}{8} \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} x + \frac {{\left (2 \, B a b + A b^{2}\right )} \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {{\left (B a^{2} + 2 \, A a b + B b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \sin \left (d x + c\right )}{4 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.05, size = 152, normalized size = 0.89 \[ \frac {a^{2} A \sin \left (d x +c \right )+B \,a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 A a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {2 B a b \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {A \,b^{2} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+b^{2} B \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.53, size = 142, normalized size = 0.84 \[ \frac {24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2} + 48 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a b - 64 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a b - 32 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A b^{2} + 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{2} + 96 \, A a^{2} \sin \left (d x + c\right )}{96 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.51, size = 169, normalized size = 0.99 \[ \frac {B\,a^2\,x}{2}+\frac {3\,B\,b^2\,x}{8}+\frac {A\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {3\,A\,b^2\,\sin \left (c+d\,x\right )}{4\,d}+A\,a\,b\,x+\frac {B\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {A\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {B\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,b^2\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}+\frac {3\,B\,a\,b\,\sin \left (c+d\,x\right )}{2\,d}+\frac {A\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d}+\frac {B\,a\,b\,\sin \left (3\,c+3\,d\,x\right )}{6\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.19, size = 338, normalized size = 1.99 \[ \begin {cases} \frac {A a^{2} \sin {\left (c + d x \right )}}{d} + A a b x \sin ^{2}{\left (c + d x \right )} + A a b x \cos ^{2}{\left (c + d x \right )} + \frac {A a b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{d} + \frac {2 A b^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {A b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {B a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {4 B a b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {2 B a b \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 B b^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 B b^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {5 B b^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\relax (c )}\right ) \left (a + b \cos {\relax (c )}\right )^{2} \cos {\relax (c )} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________